﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AdaptiveAgents.Tools
{
    class PrintRecord : Record
    {
        public int m_iGameNumber;
        public int m_iAgentNumber;

        public AgentInfo m_aiAgent0;
        public AgentInfo m_aiAgent1;
        public AgentInfo m_aiAgent2;

        private double m_dAverageProfit;




        public PrintRecord() { }

        public PrintRecord(Record rec, double[] probabilities,int game,int agent)
        {
            m_aiAgent0 = new AgentInfo(0, rec.getEpsilon(0), rec.getCompetence(0), (int)rec.getNumOfTurnsPlayed(0), probabilities[0], new ProbabilityCreatorFirstVersion(rec.getEpsilon(0)));
            m_aiAgent1 = new AgentInfo(1, rec.getEpsilon(1), rec.getCompetence(1), (int)rec.getNumOfTurnsPlayed(1), probabilities[1], new ProbabilityCreatorFirstVersion(rec.getEpsilon(1)));
            m_aiAgent2 = new AgentInfo(2, rec.getEpsilon(2), rec.getCompetence(2), (int)rec.getNumOfTurnsPlayed(2), probabilities[2], new ProbabilityCreatorFirstVersion(rec.getEpsilon(2)));

            m_iAgentNumber = agent;
            m_iGameNumber = game;
        }

        public PrintRecord clone()
        {
            PrintRecord temp = new PrintRecord();

            temp.m_dAverageProfit = m_dAverageProfit;
            temp.m_aiAgent0 = m_aiAgent0.clone();
            temp.m_aiAgent1 = m_aiAgent1.clone();
            temp.m_aiAgent2 = m_aiAgent2.clone();
            temp.m_iAgentNumber = m_iAgentNumber;
            temp.m_iGameNumber = m_iGameNumber;

            return temp;
        }

        public void setAverageProfit(double profit)
        {
            if ((profit >= 0) && (profit <= 1))
            {
                m_dAverageProfit = profit;
            }
            else
            {
                m_dAverageProfit = 0;
            }
            
        }

        public double getAverageProfit()
        {
            return m_dAverageProfit;
        }
    }
}
